package io.day03;

import java.io.*;
import java.util.Scanner;

/**
 * 使用文件流完成pw的创建
 */
public class PWDemo2 {
    public static void main(String[] args) throws FileNotFoundException {
        FileOutputStream fos = new FileOutputStream("pw2.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw,true);
        //自动行刷新

        Scanner scan = new Scanner(System.in);
        System.out.println("开始输入：");
        String str = null;
        while(true){
            if("exit".equalsIgnoreCase(str=scan.nextLine())){
                break;
            }
            pw.println(str);
            pw.println(" 世界！！！");
        }

        pw.close();
    }
}
